<?php 
# 文件名称:fdparameter.view.php
# MetInfo在线反馈系统 
# Copyright (C) 长沙米拓信息技术有限公司 (http://www.metinfo.cn). All rights reserved.
class fdparameterView extends C_view
{
	var $_pagination = '';
	
	var $_lists = '';
	
	function fdparameterView()
	{
		parent::C_view();
	}
	//加载模板
	function display($tpl)
	{		
		$SYS = &get_instance();		
		$this->assignRef('message', $SYS->loader->getMessageQueue());
		$SYS->html->script('core.js');
		$setting = array();
		//字段类型
		$setting[] = C_html::_('select.option',  1, C_text::_('Downlist1'));
		$setting[] = C_html::_('select.option',  2, C_text::_('Downlist2'));
		$setting[] = C_html::_('select.option',  3, C_text::_('Downlist3'));
		$setting[] = C_html::_('select.option',  4, C_text::_('Downlist4'));
		$setting[] = C_html::_('select.option',  5, C_text::_('Downlist5'));
		$setting[] = C_html::_('select.option',  6, C_text::_('Downlist6'));
		switch($tpl)
		{			
			case 'add':		
							$this->assignRef( 'title', C_text::_('parameter add'));
							$this->assignRef( 'subTitle',C_text::_('AddParameter'));							
							$this->assignRef('fdform', $this->get('Forms'));
							$this->assignRef('item', $this->get('Item'));
							$fdlist = C_html::_('select.genericlist',   $setting, "type", ' class="inputbox"', 'value', 'text', $this->item['type'] );
							$this->assignRef('fdlist', $fdlist);
							$this->assignRef('itemfield', $this->get('Itemfield'));
							$this->assign('apply', "add");
							$this->getJS();
							parent::display('fdparameter_edit');break;
			case 'move':
			case 'copy':	
							if($tpl == 'move') 	$this->assign( 'task','moveitems');
							else $this->assign('task','copyitems');
							$this->assignRef( 'subTitle',C_text::_($tpl.'Parameter'));
							$this->assignRef( 'forms', $this->get('Forms'));
							$this->assignRef( 'fields', $this->get('Fields'));
							parent::display('fdparameter_cm');break;
			default:
							$js_content="markRows();";
							$SYS->doc->addScriptDeclaration($js_content);
							$this->assignRef( 'forms', $this->get('Forms'));
							$this->assignRef( 'setting', $setting);
							$this->assignRef( 'items', $this->get('Items'));
							$this->assignRef( 'lists', $this->get('Lists'));
							$this->assignRef( 'pagination', $this->get('Pagination'));
							$this->assignRef('message', $SYS->loader->getMessageQueue());
							parent::display('fdparameter');
		}
							
	}
	//加载js库
	function getJS()
	{
		$SYS = &get_instance();
		$js_content="		
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}
			var flag = false;
			$$('.must').each(function(el) {
				if(el.get('value')!='')
					flag=true;
			});
			// do field validation
			if (trim(form.no_order.value) == '') {
				alert( '".C_text::_('Item1').C_text::_('Item9')."');
			} else if (form.form.value == 0) {
				alert( '".C_text::_('Item5').C_text::_('Item9')."' );
			} else if (!flag) {
				alert('".C_text::_('Must')."');
			} else {
				submitform( pressbutton );
			}
		}
		window.addEvent('domready', function(){ 
				new Accordion($$('.pane-toggler'), 
				$$('.pane-slider'), 
				{
					onActive: function(toggler, i) 
					{ 
						toggler.addClass('pane-toggler-down');toggler.removeClass('pane-toggler'); 
					},
					onBackground: function(toggler, i) 
					{ 
						toggler.addClass('pane-toggler'); toggler.removeClass('pane-toggler-down'); 
					},
					duration: 300,opacity: false,alwaysHide: true
				}); 
			});
		";
		$SYS->doc->addScriptDeclaration($js_content);
		$SYS->html->script('mootools-more.js');
	}
}
# 本程序是一个开源系统,使用时请你仔细阅读使用协议,商业用途请自觉购买商业授权.
# Copyright (C) 长沙米拓信息技术有限公司 (http://www.metinfo.cn). All rights reserved.
?>